$(function () {
    $("body").on('click','.pay-type-sel-box',function () {//选择支付方式
        $(".pay-type-sel-box").removeClass("active");
        $(this).addClass('active');
    }).on('click','#pay-order-but',function () {//立即支付
        var payType = getPayType();
        var orderNo = $("#orderNo").val();
        layer.open({
            type: 1,
            title: '提示',
            content: '支付结果是完成或遇到问题？',
            btn: [' 完成支付', '遇到问题'],
            area: 'auto',
            btnAlign: 'c',
            shade: [0.3, '#000000'],
            skin: 'lay_ppComment__wrap',
            yes: function(index, ele){
                window.location.href = baseloaction +'/web/uc/order/list';
            },
            btn2:function (index,ele) {
                window.location.href = baseloaction +'/web/uc/order/list';
            }
        });
        window.open(baseloaction + "/web/uc/pay/gotoPay?payType="+payType+"&orderNo="+orderNo,'_blank');
    });

    /**
     * 获取选中的支付类型
     * @return {string}
     */
    function getPayType() {
        var active = $(".pay-type-sel-box.active");
        if(active!=null && active.length > 0){
            return active.data('type');
        }
        return '';
    }
});